export function getDate(){
    let time =  new Date();
    let year = time.getFullYear();
    let month = time.getMonth() + 1;
    let day = formatTime(time.getDate());
    let hour = formatTime(time.getHours());
    let minutes = formatTime(time.getMinutes());
    let seconds = formatTime(time.getSeconds());

    return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
}


export function getTime(){
    let time =  new Date();
    let hour = formatTime(time.getHours());
    let minutes = formatTime(time.getMinutes());

    return hour + ":" + minutes;
}

export function formatTime(time) {
    if (time >= 0 && time <= 9) {
        return  "0" + time;
    }
    return time
}

// 时间戳转时间格式
export function getLocalTime(nS) {
    return new Date(parseInt(nS)).toLocaleString().replace(/:\d{1,2}$/,' ');
}

// 获取时间戳

export function parseTime(time) {
return new Date(time).getTime()
}
